package com.qdlc.p2p.biz.executer.impl;

import java.util.Map;

import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import com.qdlc.p2p.biz.executer.BaseExecuter;
import com.qdlc.p2p.common.constant.Global;
import com.qdlc.p2p.common.constant.LogTplNid;
import com.qdlc.p2p.common.util.BeanUtil;
import com.qdlc.p2p.dal.dao.OperationLogDao;
import com.qdlc.p2p.dal.dto.OperationLog;
import com.qdlc.p2p.dal.dto.Operator;
import com.qdlc.p2p.dal.dto.UserCreditApply;

/**
 * 信用额度申请
 * 
 * @author qj
 */
@Service
@Scope(value=ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class ApplyUserCreditExecuter extends BaseExecuter {

	protected OperationLogDao operationLogDao;

	@Override
	public void prepare() {
		operationLogDao = (OperationLogDao) BeanUtil.getBean("operationLogDao");
	}

	@Override
	public void addOperateLog() {
		Map<String, Object> map = Global.getTransfer();
		UserCreditApply userCreditApply = (UserCreditApply) map.get("userCreditApply");
		OperationLog operationLog = new OperationLog(user, new Operator(1), LogTplNid.APPLY_USER_AMOUNT);
		operationLog.setOperationResult("用户名为" + user.getUserName() + "的用户申请信用额度,申请（额度为" + userCreditApply.getAccount()
				+ "）成功，等待审核。");
		operationLogDao.save(operationLog);
	}

}
